﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class gbookview : System.Web.UI.Page
{
    public string Classn;
    protected void Page_Load(object sender, EventArgs e)
    {

		Classn="查看留言";
		try
        {

            AspNetPager1.RecordCount = (int)Socut.Data.ExecuteScalar("select count(*) from web_guestbook where gisshow=0");
			ShowData();

        }
        catch
        {
            Response.Write("为保证网站的服务质量，服务器临时维护中...请稍候!");
            Response.End();
        }
    }
	
	private void ShowData()
    {
        DataSet ds = Socut.Data.ExecuteDataSet("select * from web_guestbook where gisshow=0 order by id desc",AspNetPager1.PageSize*(AspNetPager1.CurrentPageIndex-1),AspNetPager1.PageSize);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        ShowData();
    }
	
	public string checkstatus(string str)
	{
		string strstatus="";
		if (str=="0")
		{
			strstatus="等待回复";
		}
		else if (str=="1")
		{
			strstatus="已经回复";
		}
		return strstatus;
	}
	
    public string htmlstr(string chr)
    {
        if (chr == null)
            return "";
        //chr = chr.Replace("<", "&lt");
        //chr = chr.Replace(">", "&gt");
        chr = chr.Replace("\n", "<br>");
        //chr = chr.Replace("\"", "&quot;");
        //chr = chr.Replace("'", "&#39;");
        //chr = chr.Replace(" ", "&nbsp;");
        chr = chr.Replace("select", "");
        chr = chr.Replace("delete", "");
        chr = chr.Replace("update", "");
        chr = chr.Replace("drop", "");
        //chr = chr.Replace(";", "");
        //chr = chr.Replace("(", "");
        //chr = chr.Replace(")", "");
        chr = chr.Replace("and", "");
        chr = chr.Replace("or", "");
        //chr = chr.Replace("\r", "");
        return (chr);
    }

    static bool IsNumeric(string str)
    {
        if (str == null || str.Length == 0)
            return false;
        foreach (char c in str)
        {
            if (!Char.IsNumber(c))
            {
                return false;
            }
        }
        return true;
    }
}
